var lng;
var lat;
var bmap;

(function(e) {
	setPxPerRem();
	mui.plusReady(function() {

		lng = getQueryString("lng");
		lat = getQueryString("lat");
		var point;

		if(isEmpty(lng) || isEmpty(lat)) {
			point = new BMap.Point(120.389042, 36.073204);
			mui.toast("定位失败");
		} else {
			point = new BMap.Point(lng, lat);
		}
		// 百度地图API功能
		var map = new BMap.Map("mapDiv1"); // 创建Map实例
		map.enableScrollWheelZoom();
		map.centerAndZoom(point, 15);
		var local = new BMap.LocalSearch(map, {
			renderOptions: {
				map: map,
				autoViewport: false,
				panel: "r-result"
			}
		});
		var myKeys = ["美食", "餐饮" , "小吃"];
		local.searchNearby(myKeys, point, 1000);
	});

})(mui);
var countNum = 0;

function addMarker(point, title) {
	var marker = new BMap.Marker(point);
	var label = new BMap.Label(title, {
		offset: new BMap.Size(20, -10)
	});
	marker.setLabel(label);
	bmap.addOverlay(marker);

	marker.addEventListener("click", function() {
		var postData = {
			pageflag: "page_searchAddress.html",
			itemID: point.id
		}
		var change = {
			pageUrl: 'page_buildinfo.html',
			postData: postData,
			aniShow: "fade-in"
		}
		pageChange(change);
	});

}